<template>
  <div class="seed_login">
    <div class="seed_login_box">
      <div class="seed_login_head">种子应用后台</div>
      <div class="seed_stction">
        <p class="seed_stction_p1">登录</p>
        <p class="seed_stction_p2">手机号/账号登录</p>
      </div>
      <div class="seed_login_form">
        <input class="seed_login_name" type="text" name="name" placeholder="手机号/用户名" v-model="login_info.account" autocomplete="off">
        <input class="seed_login_password" type="password" name="password" placeholder="密码" v-model="login_info.password" autocomplete="off">
        <div class="seed_login_remember">
          <div class="seed_login_remember_left">
            <!--<input class="seed_login_checkbox" type="checkbox" name="checkbox" id="checkbox">
            <label for="checkbox">记住密码</label>-->
          </div>
          <div class="seed_login_remember_right">
            <router-link :to="{name:'passport-forget'}">
              <p>忘记密码？</p>
            </router-link>
          </div>
        </div>
        <input class="seed_login_bt" type="button" value="登录" @click="login">
      </div>
      <div class="seed_register">
        <span>还没有账号</span>
        <!--<a href="register.vue">立即注册</a>-->
        <router-link :to="{name:'passport-register'}"><a>立即注册</a>
        </router-link>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      login_info: {
        account: '',
        password: ''
      }
    }
  },
  methods: {
    login () {
      if (this.login_info.account === '') {
        this.$toast('用户名不能为空')
        return false
      }
      if (this.login_info.password === '') {
        this.$toast('密码不能为空')
        return false
      }
      this.$request.Login(this.login_info).then(data => {
        this.$toast('登录成功')
        this.$utils.setCookie('token', data, 365)
        setTimeout(() => {
          this.$router.push({name: 'Home'})
        }, 500)
      })
    }
  }
}
</script>
